package org.hilo.boot.core.shiro;

import java.io.Serializable;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.eis.MemorySessionDAO;

/**
 * Override the MemorySessionDAO
 * 和MemorySessionDAO没什么差别，仅仅为了省几行异常堆栈信息
 * 
 * @author zollty
 * @since 2018年9月3日
 */
public class FastMemorySessionDAO extends MemorySessionDAO {
    
    public FastMemorySessionDAO() {
        super();
        // 使用自定义的安全SessionId生成器
        setSessionIdGenerator(new SecuritySessionIdGenerator());
    }
    
    @Override
    public Session readSession(Serializable sessionId) {
        // logger.debug("begin doReadSession {} ", sessionId);
        Session s = doReadSession(sessionId);
        if (s == null) {
            throw new UnknownSessionException("There is no session with id [" + sessionId + "]");
        }
        return s;
    }
    
}
